package com.cwvs.cat.adapter;

import java.util.List;
import java.util.Random;
import android.content.Context;
import android.support.v4.view.PagerAdapter;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;

public class WelcomeViewPagerAdapter extends PagerAdapter {
	private Random rand = new Random();
	private LayoutInflater mInflater = null;
	private Context mContext;
	private List<View> mList;

	public WelcomeViewPagerAdapter(Context context, List<View> list){
		this.mInflater = LayoutInflater.from(context);
		mList = list;
		mContext = context;
	}
	public int getCount() {
		return mList.size();
	}

	@Override
	public boolean isViewFromObject(View arg0, Object arg1) {
		return arg0 == arg1;
	}
	@Override  
	public void destroyItem(View container, int position, Object object) {  
		((ViewGroup)container).removeView(mList.get(position %mList.size()));  
	}

	@Override
	public Object instantiateItem(View container, int position) {
		// TODO Auto-generated method stub
		View view = mList.get(position);
		((ViewGroup) container).addView(mList.get(position));
		return mList.get(position);
	}

}
